import request from '@/utils/request.js'

export default {
	getFileList(fileName) {
		return request({
			url: `/file/api/getFileListByName`,
			data: {
				fileName: fileName
			}
		})
	},
	getFileByFileId(fileId) {
		return request({
			url: `/file/api/getById`,
			data: {
				fileId: fileId
			}
		})
	},
	uploadFile(formData) {
		return request({
			url: `/file/api/upload`,
			method: 'POST',
			data: formData,
			header: {
				'Content-Type': 'multipart/form-data'
			}
		});
	},
	deleteFileByFileId(fileId) {
		return request({
			url: `/file/api/delete`,
			data: {
				fileId: fileId
			}
		});
	},
	deleteFileByFileIdList(fileIdList) {
		// 构建请求参数
		const fileIdsStr = fileIdList.join(',');
		return request({
			url: `/file/api/deleteByList`,
			 data: { fileIds: fileIdsStr },
		});
	},
	downloadFileByFileId(fileId) {
		return request({
			url: `/file/api/download`,
			data: {
				fileId: fileId
			}
		});
	},
	getImageUrlByfileName(fileName) {
		return request({
			url: `/file/api/url`,
			data: {
				fileName: fileName
			}
		});
	},
	getFileListByUserName(userName) {
		return request({
			url: `/file/api/getFileListByUserName`,
			data: {
				userName: userName
			}
		})
	},
	getFileListByClassesName(classesName) {
		return request({
			url: `/file/api/getFileListByClassesName`,
			data: {
				classesName: classesName
			}
		})
	}

}